---
layout: "default"
title: "Operator: ~="
description: "Swift documentation for the '~=' operator."
root: "/v2.0"
---

<code class="language-swift">infix operator ~= {
    associativity none
    precedence 130
}</code>

<h3>Declarations</h3>

<div class="declaration" id="func-tildeeq-i_-forwardindextype-where-i_-comparable_-range-i-value_-i">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-tildeeq-i_-forwardindextype-where-i_-comparable_-range-i-value_-i">func <wbr>~= &lt;I :<wbr> ForwardIndexType where I : Comparable&gt;(<wbr>_:<wbr> Range&lt;I&gt;, value: I)</a>
        
<div class="comment collapse" id="comment-func-tildeeq-i_-forwardindextype-where-i_-comparable_-range-i-value_-i"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func ~=&lt;I : ForwardIndexType where I : Comparable&gt;(pattern: Range&lt;I&gt;, value: I) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-tildeeq-i_-intervaltype_-i-value_-i-bound">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-tildeeq-i_-intervaltype_-i-value_-i-bound">func <wbr>~= &lt;I : IntervalType&gt;(<wbr>_:<wbr> I, value: I.Bound)</a>
        
<div class="comment collapse" id="comment-func-tildeeq-i_-intervaltype_-i-value_-i-bound"><div class="p">
    <p>Returns <code>true</code> iff <code>pattern</code> contains <code>value</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func ~=&lt;I : IntervalType&gt;(pattern: I, value: I.Bound) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-tildeeq-t_-equatable_-t-b_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-tildeeq-t_-equatable_-t-b_-t">func <wbr>~= &lt;T : Equatable&gt;(<wbr>_:<wbr> T, b: T)</a>
        
<div class="comment collapse" id="comment-func-tildeeq-t_-equatable_-t-b_-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func ~=&lt;T : Equatable&gt;(a: T, b: T) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-tildeeq-t_-optionalnilcomparisontype-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-tildeeq-t_-optionalnilcomparisontype-rhs_-t">func ~= &lt;T&gt;(<wbr>_:<wbr> _OptionalNilComparisonType, rhs: T?)</a>
        
<div class="comment collapse" id="comment-func-tildeeq-t_-optionalnilcomparisontype-rhs_-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func ~=&lt;T&gt;(lhs: _OptionalNilComparisonType, rhs: T?) -&gt; Bool</code>
    
    
</div></div>
</div>
